package com.kmproject.haifu.mvp.ui.adapter;

import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.kmproject.haifu.R;
import com.kmproject.haifu.mvp.model.entity.beans.HousePayWayBean;
import com.kmproject.haifu.mvp.model.entity.beans.SeletCityBean;

import java.util.List;

public class PopuwindowSelectTypeAdapter extends BaseQuickAdapter<SeletCityBean,BaseViewHolder> {
    private ClickBack mclickBack;
    public PopuwindowSelectTypeAdapter( @Nullable List<SeletCityBean> data,ClickBack clickBack) {
        super(R.layout.popuwindow_select_city_item, data);
        mclickBack=clickBack;
    }

    @Override
    protected void convert(BaseViewHolder helper, SeletCityBean item) {
       helper.<TextView>getView(R.id.popuwindow_select_city_item_title).setText(item.getDataIndex());
      helper.<RecyclerView>getView(R.id.popuwindow_select_city_item_RecyclerView).setLayoutManager(new LinearLayoutManager(mContext));
        PopuWindowSelectAddress1Adapter popuWindowSelectAddress1Adapter=new PopuWindowSelectAddress1Adapter(-1,item.getData(), new PopuWindowSelectAddress1Adapter.BtncliickCallBack() {
            @Override
            public void callBack(int index, Object content) {
                mclickBack.callback(helper.getAdapterPosition(),index);
            }
        });
        popuWindowSelectAddress1Adapter.setShowLine(true);
        popuWindowSelectAddress1Adapter.setSelectIndex(-1);
        helper.<RecyclerView>getView(R.id.popuwindow_select_city_item_RecyclerView).setAdapter(popuWindowSelectAddress1Adapter);

    }

    public interface ClickBack{
        void callback(int parmentIndex, int childIndex);
    }
}
